from tkinter import *

def Story1(Win):
    def final(tl:Toplevel,name,sports,City,playername,drinkname,snacks):
        text = f'''
       One day me and my friend {name} decided to play a {sports} game in {City}.
       But we were not able to play.So, we went to watch the game and our favourite player {playername}.
       We drank {drinkname} and also ate some {snacks} 
       We really enjoyed it! We are looking forward to go again and enjoy '''
        tl.geometry(newGeometry='500x500')
        Label(tl,text='Story:',wraplength=tl.winfo_width()).place(x=160,y=310)
        Label(tl,text=text,wraplength=tl.winfo_width()).place(x=0,y=330)
    
        
    NewScreen = Toplevel(Win,bg='yellow')
    NewScreen.geometry('500x500')
    NewScreen.title('A memorable day')
    Label(NewScreen,text='A Memorable day').place(x=100,y=0)
    Label(NewScreen,text='Name').place(x=0,y=35)
    Label(NewScreen,text='Entry a game').place(x=0,y=70)
    Label(NewScreen,text='Entry a city').place(x=0,y=110)
    Label(NewScreen,text='Entry a player').place(x=0,y=150)
    Label(NewScreen,text='Entry a drink').place(x=0,y=190)
    Label(NewScreen,text='Entry a snack').place(x=0,y=230)

    Name = Entry(NewScreen,width=17)
    Name.place(x=250,y=35)
    game = Entry(NewScreen,width=17)
    game.place(x=250,y=70)
    city = Entry(NewScreen,width=17)
    city.place(x=250,y=110)
    player = Entry(NewScreen,width=17)
    player.place(x=250,y=150)
    drink = Entry(NewScreen,width=17)
    drink.place(x=250,y=190)
    snack = Entry(NewScreen,width=17)
    snack.place(x=250,y=230)

    SubmitButton = Button(NewScreen,text='Submit',background='Blue',font=('Time',12),
                          command=lambda:final(NewScreen,Name.get(),game.get(),city.get(),
                                               player.get(),drink.get(),snack.get()))
    SubmitButton.place(x=150, y=270)


def Story2(Win):
    def final(tl:Toplevel,profession,noun,feeling,emotion,verb):
        text = f'''
        When I was a child, I wanted to become a {profession}
          but as I grew up I got into the {noun} and decided to become an
          engineer. Then I went into a job that I was not {feeling} at.
          After getting {emotion} I decided to do what I love.
          Despite getting lower{verb} than I used to get in my previous job.I am very
          feeling '''
        tl.geometry(newGeometry='500x500')
        Label(tl,text='Story:',wraplength=tl.winfo_width()).place(x=160,y=310)
        Label(tl,text=text,wraplength=tl.winfo_width()).place(x=0,y=330)

    
    NewScreen = Toplevel(Win,bg='red')
    NewScreen.geometry('500x500')
    NewScreen.title('Ambition')
    Label(NewScreen,text='Ambition').place(x=100,y=0)
    Label(NewScreen,text='profession').place(x=0,y=35)
    Label(NewScreen,text='Entry a noun').place(x=0,y=70)
    Label(NewScreen,text='Entry a feeling').place(x=0,y=110)
    Label(NewScreen,text='Entry a emotion').place(x=0,y=150)
    Label(NewScreen,text='Entry a verb').place(x=0,y=190)

    profession = Entry(NewScreen,width=17)
    profession.place(x=250,y=35)
    noun = Entry(NewScreen,width=17)
    noun.place(x=250,y=70)
    feeling = Entry(NewScreen,width=17)
    feeling.place(x=250,y=110)
    emotion = Entry(NewScreen,width=17)
    emotion.place(x=250,y=150)
    verb = Entry(NewScreen,width=17)
    verb.place(x=250,y=190)

    SubmitButton = Button(NewScreen,text='Submit',background='Blue',font=('Time',12),
                          command=lambda:final(NewScreen,profession.get(),noun.get(),feeling.get(),
                                               emotion.get(),verb.get()))
    SubmitButton.place(x=150, y=270)

Screen = Tk()
Screen.title("PythonGeeks Mad Libs Generator")
Screen.config(bg="pink")
Screen.geometry("400x400")
Label(Screen,text="PythonGeeks Mad Libs Generator").place(x=100,y=20)

Story1Button = Button(Screen,text="A memorable day",font=('Times New Roman',13),
                      command=lambda:Story1(Screen),bg='blue')
Story1Button.place(x=140, y=90)
Story2Button = Button(Screen,text='Ambition',font=('Times New Roman',13),
                      command=lambda:Story2(Screen),bg='blue')
Story2Button.place(x=160, y=150)
Screen.update()
Screen.mainloop()

